package core.resources
{
import core.Configuration;
import core.Language;

import flash.events.Event;
import flash.net.URLLoader;

public class LanguageResourceTask extends LoadTaskBase
{
	public function LanguageResourceTask()
	{
		super();
	}
	
	override public function start():void
	{
		startToLoad(Configuration.languagePath, languageLoadedHandler);
	}	
	//==========================================================================
	//  Event handlers
	//==========================================================================    
	protected function languageLoadedHandler(event:Event):void
	{
		var loader:URLLoader = URLLoader(event.target);
		loader.removeEventListener(Event.COMPLETE, languageLoadedHandler);
		
		Language.initialize(XML(loader.data));
        
        this.complete();
	}
}
}



